package converter;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import repository.FriendRequestRepository;
import domain.FriendRequest;

@Component
public class FriendRequestConverter implements Converter<String, FriendRequest>{
	
	private FriendRequestRepository friendRequestRepository;
	
	@Autowired
	public FriendRequestConverter(FriendRequestRepository friendRequestRepository) {
		this.friendRequestRepository = friendRequestRepository;
	}

	@Override
	public FriendRequest convert(String source) {
		return friendRequestRepository.get(Integer.valueOf(source));
	}

}
